package com.smasher.net.help

/**
 * 内网：192.168.1.225:30000
 * 外网：222.75.158.78:30000
 */
object Confucius {

    private var scheme = ""

    private var host = ""

    private var port = 0

    val suffix: String
        get() = calculateSuffix(false)

    val suffixPro: String
        get() = calculateSuffix(true)

    fun init(scheme: String, host: String, port: Int) {
        this.scheme = scheme
        this.host = host
        this.port = port
    }

    private fun calculateSuffix(isPro: Boolean): String {
        val portPart = if (port == -1) "" else ":$port"
        val suffix = "$scheme://$host$portPart"
        return if (isPro) "$suffix/" else suffix
    }
}